{% extends "base.html" %}

{% block title %}实时监控{% endblock %}

{% block content %}
<div class="container-fluid">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h2>监控点列表</h2>
        <a href="{{ url_for('monitor.add_point') }}" class="btn btn-primary">
            <i class="fas fa-plus"></i> 添加监控点
        </a>
    </div>

    <div class="row row-cols-1 row-cols-md-2 row-cols-xl-3 g-4">
        {% for point in points %}
        <div class="col">
            <div class="card h-100">
                <div class="card-body">
                    <h5 class="card-title">{{ point.name }}</h5>
                    <p class="card-text">
                        <i class="fas fa-map-marker-alt"></i> {{ point.location }}<br>
                        <small class="text-muted">{{ point.description }}</small>
                    </p>
                    <div class="btn-group">
                        <a href="{{ url_for('monitor.view_point', point_id=point.id) }}" class="btn btn-primary">
                            查看详情
                        </a>
                        <a href="{{ url_for('monitor.add_data', point_id=point.id) }}" class="btn btn-success">
                            添加数据
                        </a>
                        <form action="{{ url_for('monitor.delete_point', point_id=point.id) }}" method="POST" class="d-inline" onsubmit="return confirm('确定要删除这个监控点吗？这将同时删除所有相关的监控数据！');">
                            <button type="submit" class="btn btn-danger">删除</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        {% endfor %}
    </div>
</div>
{% endblock %} 